home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc / Documentation / Tech Notes & Articles / Recipes / Imaging & Layout / Part Drawing < prev    next >
Encoding:
Text File  |  1995-03-14  |  2.7 KB  |  44 lines  |  [TEXT/ttxt]

  1. OpenDoc™ Recipes
  2.  
  3.  
  4. Part Drawing
  5. By The OpenDoc Design Team
  6. 19 April, 1994
  7.  
  8.  
  9. © 1993-1995  Apple Computer, Inc. All Rights Reserved.
  10. Apple, the Apple logo, and Macintosh are registered trademarks of Apple Computer, Inc.
  11. Mac and OpenDoc are trademarks of Apple Computer, Inc. 
  12.         
  13.  
  14. Basic Drawing
  15.  
  16. Part editors must be able to display their parts in response to the ::Draw() call.
  17.  
  18. void Draw(in ODFacet* facet, in ODShape* invalidShape)
  19.  
  20. Draw the part in the given facet. Only the portion in the invalidShape needs to be drawn.
  21.  
  22. There are several steps a part needs to take to perform the imaging.
  23.  
  24. 1)     The part should look at the given facet and its frame. Both the frame and the facet may have some partInfo that the part has placed there, which the part can use to decide how it will display itself.  The frame also has viewType and presentation fields, which indicate what kind of view of the part should display.
  25.  
  26. 2)     The part should examine its canvas to see how it should be imaged. The canvas can be obtained from the facet via ODFacet::GetCanvas(). If the canvas’ isDynamic flag is kODTrue, the part is imaging onto a dynamic device like a CRT; otherwise, it is imaging to a static device like a printer. The part will probably display its content differently for static and dynamic views. For instance, it should not display scroll bars on a static canvas.
  27.  
  28. 3)     The part must make sure the platform graphics system is prepared to draw into the correct context for the facet. On the Macintosh using QuickDraw, it is necessary to call SetPort() for the appropriate canvas, and set up other attributes of the drawing environment. A FocusLib library is supplied to help focus drawing commands to a facet. Make sure to clip to the facet’s clipShape (FocusLib does this for you).
  29.  
  30. 4)     Draw the part’s contents.
  31.  
  32. 5)     Restore the old graphics environment.
  33.  
  34. Asynchronous drawing
  35.  
  36. Part editors may sometimes need to display their parts asynchronously, that is, not in response to a ::Draw() call. This process is very similar to the basic drawing recipe, with minor modifications.
  37.  
  38. 1)     Determine which of the part’s frames should be drawn. A part may have multiple display frames, and more than one may need updating. Parts store their display frames in whatever way they want, so we can’t tell you how to find them here.
  39.  
  40. 2)     For each frame being displayed, all visible facets must be drawn. ODFrame::CreateFrameFacetIterator() returns an iterator which will list all the facets of a frame. Draw the part’s contents in each of these facets, using the recipe above.
  41.  
  42. 3)     After drawing in a facet, call ODFacet::DrawnIn() on it to tell it you’ve drawn in it asynchronously. If the facet is on an offscreen canvas, this lets it get copied into the window.
  43.  
  44.